<template>
  <div>
    <div class="item">
      <!-- <div>{{ index }}</div> -->
      <div>{{ item }}</div>
      <button @click="delItem(index)">删除</button>
    </div>
  </div>
</template>

<script>
/* 
删除操作
删除arr当中指定的数据 index  splice(index,1)
找下标
item没有下标 父组件list当中有下标 


*/

export default {
  props: ["item", "index"],
  methods: {
    delItem(index) {
      //   console.log(index);
      // 将index传递给app 在app当中删除arr中的某项
      this.$eventBus.$emit("deleteItem", index);
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  display: flex;
  justify-content: space-around;
}
</style>